const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectId;
const url = "mongodb://taosha_user:apyl8XWP6LSW4JHs@101.35.6.34:27722/taosha";

async function main() {
  const client = await MongoClient.connect(url);
  const db = client.db('taosha');

  db.listCollections().forEach((collection) => {
    let table = db.collection(collection.name);
    table.updateMany(
      {'createAt': {$exists: true}},
      {$rename: {'createAt': 'createdAt'}}
    );

    console.log('ok...');
  });


}

main();
